com.highdeal.pnr.hci
Class CounterModel

java.lang.Object
  extended by com.highdeal.pnr.hci.CounterModel
All Implemented Interfaces:
XMLMarshallable

public class CounterModel
extends java.lang.Object
implements XMLMarshallable

This class represents a counter in a business relationship. A counter has a name and a current value.

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="counter">
   <xs:complexType>
     <xs:attribute name="name" type="xs:string" use="required"/>
     <xs:attribute name="value" type="xs:decimal"/>
   </xs:complexType>
 </xs:element>


Field Summary
static java.lang.String TAG_NAME
          The value of that constant is the XML tag name of the CounterModel.
 
Constructor Summary
CounterModel()
          Constructs an empty counter object.
CounterModel(CounterDescriptionModel counterDesc)
          Constructs a counter object from a Counter description object
CounterModel(java.lang.String name)
          Constructs a counter object with a name.
CounterModel(java.lang.String name, java.math.BigDecimal value)
          Constructs a counter object with a name and a current value.
 
Method Summary
 void addCharacterData(java.lang.String cData)
          Adds character data to the content element.
 void addChild(java.lang.String name, XMLMarshallable child)
          Adds a child to the object, the child representing the marshallable object which must be added to the element.
 boolean checkValidity()
          Returns true if the counter is valid.
 java.lang.String getName()
          Returns the name of the counter.
 java.math.BigDecimal getValue()
          Returns the value of the counter.
 void marshal(XMLOutputter output)
          Gives an XML representation of this object, including its children.
 void setAttributes(XMLAttributes atts)
          Sets the attributes of the XML representation of the element being processed.
 void setName(java.lang.String name)
          Sets the name of the counter.
 void setValue(java.math.BigDecimal value)
          Sets the value of the counter.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TAG_NAME

public static final java.lang.String TAG_NAME
The value of that constant is the XML tag name of the CounterModel.

See Also:
Constant Field Values
Constructor Detail

CounterModel

public CounterModel()
Constructs an empty counter object.


CounterModel

public CounterModel(java.lang.String name)
Constructs a counter object with a name.

Parameters:
name - the name of the counter.

CounterModel

public CounterModel(java.lang.String name,
                    java.math.BigDecimal value)
Constructs a counter object with a name and a current value.

Parameters:
name - the name of the counter.
value - the current value of the counter.

CounterModel

public CounterModel(CounterDescriptionModel counterDesc)
Constructs a counter object from a Counter description object

Parameters:
counterDesc - the Counter description object used as base for the construction of the Counter object.
Method Detail

getName

public java.lang.String getName()
Returns the name of the counter.

Returns:
the name of the counter.

setName

public void setName(java.lang.String name)
Sets the name of the counter.

Parameters:
name - the name of the counter.

getValue

public java.math.BigDecimal getValue()
Returns the value of the counter.

Returns:
the value of the counter.

setValue

public void setValue(java.math.BigDecimal value)
Sets the value of the counter.

Parameters:
value - the value of the counter.

checkValidity

public boolean checkValidity()
Returns true if the counter is valid. Counter is valid if its name is not null or empty and if its current value is set to a non null value.

Returns:
true if the counter is valid, false otherwise.

setAttributes

public void setAttributes(XMLAttributes atts)
Description copied from interface: XMLMarshallable
Sets the attributes of the XML representation of the element being processed.

Specified by:
setAttributes in interface XMLMarshallable
Parameters:
atts - The XML attributes of the current element

addChild

public void addChild(java.lang.String name,
                     XMLMarshallable child)
Description copied from interface: XMLMarshallable
Adds a child to the object, the child representing the marshallable object which must be added to the element.

Specified by:
addChild in interface XMLMarshallable
Parameters:
name - The name of tag for the child
child - The child to be added

addCharacterData

public void addCharacterData(java.lang.String cData)
Description copied from interface: XMLMarshallable
Adds character data to the content element.

Specified by:
addCharacterData in interface XMLMarshallable
Parameters:
cData - The character data to be added

marshal

public void marshal(XMLOutputter output)
Description copied from interface: XMLMarshallable
Gives an XML representation of this object, including its children.

Specified by:
marshal in interface XMLMarshallable
Parameters:
output - The XML output to marshal the object into

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)